package cn.mothin.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.mothin.entity.MenuConfig;
import cn.mothin.frame.core.base.BaseDao;

@Repository("ab7b7f31-80ca-4598-9517-efccdcc7895a")
public class MenuConfigDao extends BaseDao<MenuConfig> {
	public List<MenuConfig> findMenuConfigs(String parentId) {
		if (parentId == null) {
			String sql = "SELECT * FROM menu_config WHERE parentId IS NULL ORDER BY ordinal";
			return query(sql);
		} else {
			String sql = "SELECT * FROM menu_config WHERE parentId = ? ORDER BY ordinal";
			return query(sql, parentId);
		}
	}

	public List<String> getIcoList() {
		String sql = "SELECT DISTINCT ico FROM menu_config";
		return sqlHelper.queryForList(String.class, sql);
	}
}
